<section class="content-header">
    <h1>订单搜索</h1>
</section>

<section class="content sm-content">
    <div class="box box-primary">
        <div class="box-header">
            <h3 class="box-title">查询条件</h3>
        </div>
        <div class="box-body form-horizontal order-form">
            <div class="form-group">
                <label class="control-label col-sm-2">时间范围</label>
                <div class="input-group col-sm-10" style="padding-left: 15px;padding-right: 15px;">
                    <div class="input-group-addon" style="border-radius: 5px 0 0 5px!important;">
                        <i class="fa fa-calendar"></i>
                    </div>
                    <input id="time" type="text" class="form-control pull-right" style="border-radius: 0 5px 5px 0!important;" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">访客类型</label>
                <div class="col-sm-10">
                    <select class="form-control" ng-model="search_obj.visitor_type" ng-options="type.value as type.label for type in visitor_type_options">
                        <option value="">所有</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">订单状态</label>
                <div class="col-sm-10">
                    <select class="form-control" ng-model="search_obj.order_status" ng-options="status.value as status.label for status in order_status_options">
                        <option value="">所有</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">订单类型</label>
                <div class="col-sm-10">
                    <select class="form-control" ng-model="search_obj.order_type" ng-options="type.value as type.label for type in order_type_options">
                        <option value="">所有</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">是否成团</label>
                <div class="col-sm-10">
                    <select class="form-control" ng-model="search_obj.is_group" ng-options="type.value as type.label for type in is_group_options">
                        <option value="">所有</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">访客姓名</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" placeholder="访客姓名" ng-model="search_obj.visitor_name" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">手机号</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" placeholder="手机号" ng-model="search_obj.mobile" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">订单号</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" placeholder="订单号" ng-model="search_obj.order_id" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">景区名称</label>
                <div class="col-sm-10">
                    <select class="form-control" ng-model="search_obj.region_id" ng-options="region.region_id as region.name for region in regions">
                        <option value="">选择景区</option>
                    </select>
                </div>
            </div>
            <button type="button" class="btn btn-success pull-right" style="clear: both;font-weight: bold" ng-click="searchOrder(0)">查 询</button>
        </div>
    </div>
</section>

<section class="content">
    <div class="box box-primary">
        <div class="box-header">
            <i class="ion ion-clipboard"></i>
            <h3 class="box-title">订单列表(人数: {{orders.totalVisitorCount}})</h3>
            <div class="box-tools pull-right">
                <a class="btn btn-block btn-primary" ng-click="export()">导出excel</a>
            </div>
        </div>
        <div class="box-body text-center" ng-show="orders.items.length == 0">未搜索到订单</div>
        <div class="box-body no-padding" ng-show="orders.items.length != 0">
            <table class="table table-striped text-center">
                <tbody>
                    <tr>
                        <th>订单号</th>
                        <th>景区名称</th>
                        <th>线路日期</th>
                        <th>订单金额</th>
                        <th>订单状态</th>
                        <th>访客姓名</th>
                        <th>访客类型</th>
                        <th>访客人数</th>
                        <th>是否成团</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                    <tr ng-repeat="order in orders.items">
                        <td><a href="#/ordersDetail/{{order.order_id}}" target="_blank">{{order.order_id}}</a></td>
                        <td>{{order.region_name}}</td>
                        <td>{{order.line_date || '--'}}</td>
                        <td>{{order.amount}}元</td>
                        <td>{{order.order_status_desc}}</td>
                        <td>{{order.visitor_name}}</td>
                        <td>{{order.visitor_type_desc}}</td>
                        <td>{{order.visitor_count}}</td>
                        <td>{{order.is_group_desc}}</td>
                        <td>{{order.create_time}}</td>
                        <td>
                            <span ng-if="!order.isTicket">--</span>
                            <button class="btn btn-block btn-success btn-xs" ng-if="order.isTicket" ng-click="getTicket(order)">出票</button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="box-footer clearfix" ng-show="orders.items.length != 0">
            <ul class="pagination pagination-sm no-margin pull-right">
                <li ng-class="{'active': page_cur == page}" ng-repeat="page in pages"><a ng-click="searchOrder(1, page)">{{page}}</a></li>
            </ul>
        </div>
        <div class="overlay" ng-show="isLoading">
            <i class="fa fa-refresh fa-spin"></i>
        </div>
    </div>
</section>